//  @ts-nocheck
import request from '@/utils/request'

// 获取基础列表的函数
export const getListData = params => {
  return request({
    url: '/questions',
    method: 'GET',
    params: params
  })
}

// 根据id查询题型详情
export const getquestionType = id => {
  return request({
    url: `/questions/${id}`,
    data: 'GET',
    params: {
      isNext: true
    }
  })
}

// 根据id删除基础题库
export const delQuestion = id => {
  return request({
    url: `/questions/${id}`,
    method: 'DELETE'
  })
}

// 根据id加入或删除精选题库
export const intoChoice = (id, choiceState) => {
  return request({
    url: `/questions/choice/${id}/ ${choiceState}`,
    method: 'PATCH'
  })
}

// ================================================================
// 获取精选题库的简单列表
export const getGoodquestion = params => {
  return request({
    url: '/questions/choice',
    method: 'GET',
    params: params
  })
}

// 上下架题目 1是上价 0是下架
export const upQuestion = (id, publishState) => {
  return request({
    url: `/questions/choice/${id}/${publishState}`,
    method: 'POST'
  })
}

// 试题审核
export const changeQuestionChkState = (id, data) => {
  return request({
    url: `/questions/check/${id}`,
    method: 'POST',
    data: data
  })
}

// ========================================================
// 题组列表
// 获取题组列表
export const teamQuestion = params => {
  return request({
    url: '/questions/randoms/',
    method: 'GET',
    params: params
  })
}

// 题组列表的删除
export const delteamQuestion = id => {
  return request({
    url: `/questions/randoms/${id}`,
    method: 'DELETE'
  })
}
